#include <iostream>
#include <string>
#include <vector>

#include "../util.h"
#include "tm.h"

using std::string;
using std::vector;

int main(int argc, char **argv) {
    if (argc != 2) {
        std::cerr << "executable <filelist>" << std::endl;
        return 1;
    }
    try {
        string filelist = argv[1];
        TRawReader rawReaderRu;
        TRawReader rawReaderEn;
        std::ifstream f(filelist.c_str());
        string str;
        getline(f, str);
        vector<string> params = SplitString(str);
        if (params.size() != 5) {
            throw TException("5 filenames on a line expected");
        }
        TFileNames filenames(params[0], params[1], params[2], params[3], params[4]);
        ProcessFiles(filenames, rawReaderRu, rawReaderEn);
    }
    catch (const std::exception& err) {
        std::cerr << err.what() << std::endl;
        return 1;
    }
    return 0;
}
